-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cassandra] Add: schema browser support & explicit protocol version #1482
Conversation
…o 3 (Also working with cassandra version 2.1 and above)
schema[table_name] = {'name': table_name, 'columns': []} | ||
CN_query = """ | ||
SELECT column_name FROM system.schema_columns where keyspace_name ='{}' and columnfamily_name ='{}'; | ||
""".format(self.configuration['keyspace'], table_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not run: SELECT columnfamily_name, column_name FROM system.schema_columns where keyspace_name ='{}'
and split them to column families in the code? This way you need to run only a single query instead of N queries.
@@ -54,22 +54,36 @@ def type(cls): | |||
return "Cassandra" | |||
|
|||
def _get_tables(self, schema): | |||
query = """ | |||
CF_query = """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf_query
@@ -14,7 +14,7 @@ | |||
enabled = False | |||
|
|||
|
|||
class Cassandra(BaseQueryRunner): | |||
class Cassandra(BaseSQLQueryRunner): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because when I use BaseQueryRunner i'm getting empty list []
for get_tables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, because you need to implement get_schema
instead (get_tables
is a method BaseSQLQueryRunner uses for get_schema
).
What's the need for protocol version? |
I added this because I want to avoid from the warning log. If you are using Cassandra 2.1 so it throws a warning about downgrading the protocol version. This is from the cassandra driver code - https://github.com/datastax/python-driver/blob/master/cassandra/cluster.py#L1118 |
OK, if anyone will have a problem with this, we will add this as a parameter. |
Btw, Scylla supports this too, right? |
Yes. |
Thanks ! :) |
[Cassandra] Add: schema browser support & explicit protocol version
…o 3 (Also working with cassandra version 2.1 and above)